Optimal. Leaf size=111 \[ \frac {6 b^2 x \cos (c+d x)}{d^3}-\frac {2 a b x \cos (c+d x)}{d}-\frac {b^2 x^3 \cos (c+d x)}{d}+a^2 \text {Ci}(d x) \sin (c)-\frac {6 b^2 \sin (c+d x)}{d^4}+\frac {2 a b \sin (c+d x)}{d^2}+\frac {3 b^2 x^2 \sin (c+d x)}{d^2}+a^2 \cos (c) \text {Si}(d x) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 111, normalized size of antiderivative = 1.00, number of steps
used = 11, number of rules used = 6, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3420, 3384,
3380, 3383, 3377, 2717} \begin {gather*} a^2 \sin (c) \text {CosIntegral}(d x)+a^2 \cos (c) \text {Si}(d x)+\frac {2 a b \sin (c+d x)}{d^2}-\frac {2 a b x \cos (c+d x)}{d}-\frac {6 b^2 \sin (c+d x)}{d^4}+\frac {6 b^2 x \cos (c+d x)}{d^3}+\frac {3 b^2 x^2 \sin (c+d x)}{d^2}-\frac {b^2 x^3 \cos (c+d x)}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2717
Rule 3377
Rule 3380
Rule 3383
Rule 3384
Rule 3420
Rubi steps
\begin {align*} \int \frac {\left (a+b x^2\right )^2 \sin (c+d x)}{x} \, dx &=\int \left (\frac {a^2 \sin (c+d x)}{x}+2 a b x \sin (c+d x)+b^2 x^3 \sin (c+d x)\right ) \, dx\\ &=a^2 \int \frac {\sin (c+d x)}{x} \, dx+(2 a b) \int x \sin (c+d x) \, dx+b^2 \int x^3 \sin (c+d x) \, dx\\ &=-\frac {2 a b x \cos (c+d x)}{d}-\frac {b^2 x^3 \cos (c+d x)}{d}+\frac {(2 a b) \int \cos (c+d x) \, dx}{d}+\frac {\left (3 b^2\right ) \int x^2 \cos (c+d x) \, dx}{d}+\left (a^2 \cos (c)\right ) \int \frac {\sin (d x)}{x} \, dx+\left (a^2 \sin (c)\right ) \int \frac {\cos (d x)}{x} \, dx\\ &=-\frac {2 a b x \cos (c+d x)}{d}-\frac {b^2 x^3 \cos (c+d x)}{d}+a^2 \text {Ci}(d x) \sin (c)+\frac {2 a b \sin (c+d x)}{d^2}+\frac {3 b^2 x^2 \sin (c+d x)}{d^2}+a^2 \cos (c) \text {Si}(d x)-\frac {\left (6 b^2\right ) \int x \sin (c+d x) \, dx}{d^2}\\ &=\frac {6 b^2 x \cos (c+d x)}{d^3}-\frac {2 a b x \cos (c+d x)}{d}-\frac {b^2 x^3 \cos (c+d x)}{d}+a^2 \text {Ci}(d x) \sin (c)+\frac {2 a b \sin (c+d x)}{d^2}+\frac {3 b^2 x^2 \sin (c+d x)}{d^2}+a^2 \cos (c) \text {Si}(d x)-\frac {\left (6 b^2\right ) \int \cos (c+d x) \, dx}{d^3}\\ &=\frac {6 b^2 x \cos (c+d x)}{d^3}-\frac {2 a b x \cos (c+d x)}{d}-\frac {b^2 x^3 \cos (c+d x)}{d}+a^2 \text {Ci}(d x) \sin (c)-\frac {6 b^2 \sin (c+d x)}{d^4}+\frac {2 a b \sin (c+d x)}{d^2}+\frac {3 b^2 x^2 \sin (c+d x)}{d^2}+a^2 \cos (c) \text {Si}(d x)\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.25, size = 82, normalized size = 0.74 \begin {gather*} -\frac {b x \left (2 a d^2+b \left (-6+d^2 x^2\right )\right ) \cos (c+d x)}{d^3}+a^2 \text {Ci}(d x) \sin (c)+\frac {b \left (2 a d^2+3 b \left (-2+d^2 x^2\right )\right ) \sin (c+d x)}{d^4}+a^2 \cos (c) \text {Si}(d x) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(235\) vs.
\(2(111)=222\).
time = 0.14, size = 236, normalized size = 2.13
method | result | size |
derivativedivides | \(a^{2} \left (\sinIntegral \left (d x \right ) \cos \left (c \right )+\cosineIntegral \left (d x \right ) \sin \left (c \right )\right )+\frac {4 a b c \cos \left (d x +c \right )}{d^{2}}+\frac {2 \left (c +1\right ) a b \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {4 b^{2} c^{3} \cos \left (d x +c \right )}{d^{4}}+\frac {6 \left (c +1\right ) b^{2} c^{2} \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{4}}-\frac {4 b^{2} c \left (c^{2}+c +1\right ) \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{4}}+\frac {\left (c^{3}+c^{2}+c +1\right ) b^{2} \left (-\left (d x +c \right )^{3} \cos \left (d x +c \right )+3 \left (d x +c \right )^{2} \sin \left (d x +c \right )-6 \sin \left (d x +c \right )+6 \left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{4}}\) | \(236\) |
default | \(a^{2} \left (\sinIntegral \left (d x \right ) \cos \left (c \right )+\cosineIntegral \left (d x \right ) \sin \left (c \right )\right )+\frac {4 a b c \cos \left (d x +c \right )}{d^{2}}+\frac {2 \left (c +1\right ) a b \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {4 b^{2} c^{3} \cos \left (d x +c \right )}{d^{4}}+\frac {6 \left (c +1\right ) b^{2} c^{2} \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{4}}-\frac {4 b^{2} c \left (c^{2}+c +1\right ) \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{4}}+\frac {\left (c^{3}+c^{2}+c +1\right ) b^{2} \left (-\left (d x +c \right )^{3} \cos \left (d x +c \right )+3 \left (d x +c \right )^{2} \sin \left (d x +c \right )-6 \sin \left (d x +c \right )+6 \left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{4}}\) | \(236\) |
meijerg | \(\frac {8 b^{2} \sqrt {\pi }\, \sin \left (c \right ) \left (\frac {3}{4 \sqrt {\pi }}-\frac {\left (-\frac {3 d^{2} x^{2}}{2}+3\right ) \cos \left (d x \right )}{4 \sqrt {\pi }}-\frac {d x \left (-\frac {d^{2} x^{2}}{2}+3\right ) \sin \left (d x \right )}{4 \sqrt {\pi }}\right )}{d^{4}}+\frac {8 b^{2} \sqrt {\pi }\, \cos \left (c \right ) \left (\frac {x d \left (-\frac {5 d^{2} x^{2}}{2}+15\right ) \cos \left (d x \right )}{20 \sqrt {\pi }}-\frac {\left (-\frac {15 d^{2} x^{2}}{2}+15\right ) \sin \left (d x \right )}{20 \sqrt {\pi }}\right )}{d^{4}}+\frac {4 b a \sqrt {\pi }\, \sin \left (c \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {d x \sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}+\frac {4 b a \sqrt {\pi }\, \cos \left (c \right ) \left (-\frac {d x \cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {\sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}+\frac {a^{2} \sqrt {\pi }\, \sin \left (c \right ) \left (\frac {2 \gamma +2 \ln \left (x \right )+\ln \left (d^{2}\right )}{\sqrt {\pi }}-\frac {2 \gamma }{\sqrt {\pi }}-\frac {2 \ln \left (2\right )}{\sqrt {\pi }}-\frac {2 \ln \left (\frac {d x}{2}\right )}{\sqrt {\pi }}+\frac {2 \cosineIntegral \left (d x \right )}{\sqrt {\pi }}\right )}{2}+a^{2} \cos \left (c \right ) \sinIntegral \left (d x \right )\) | \(255\) |
risch | \(-\frac {{\mathrm e}^{-i c} \pi \,\mathrm {csgn}\left (d x \right ) a^{2}}{2}+{\mathrm e}^{-i c} \sinIntegral \left (d x \right ) a^{2}+\frac {i a^{2} {\mathrm e}^{i c} \expIntegral \left (1, -i d x \right )}{2}-\frac {i {\mathrm e}^{-i c} \expIntegral \left (1, -i d x \right ) a^{2}}{2}+\frac {b^{2} \cos \left (d x +c \right ) x^{4}}{-d x -2 c}+\frac {2 b^{2} \cos \left (d x +c \right ) c \,x^{3}}{d \left (-d x -2 c \right )}+\frac {2 b \cos \left (d x +c \right ) a \,x^{2}}{-d x -2 c}+\frac {4 b \cos \left (d x +c \right ) a c x}{d \left (-d x -2 c \right )}-\frac {6 b^{2} \cos \left (d x +c \right ) x^{2}}{d^{2} \left (-d x -2 c \right )}-\frac {12 b^{2} \cos \left (d x +c \right ) c x}{d^{3} \left (-d x -2 c \right )}-\frac {3 b^{2} \sin \left (d x +c \right ) x^{3}}{d \left (-d x -2 c \right )}-\frac {6 b^{2} \sin \left (d x +c \right ) c \,x^{2}}{d^{2} \left (-d x -2 c \right )}-\frac {2 b \sin \left (d x +c \right ) a x}{d \left (-d x -2 c \right )}-\frac {4 b \sin \left (d x +c \right ) a c}{d^{2} \left (-d x -2 c \right )}+\frac {6 b^{2} \sin \left (d x +c \right ) x}{d^{3} \left (-d x -2 c \right )}+\frac {12 b^{2} \sin \left (d x +c \right ) c}{d^{4} \left (-d x -2 c \right )}\) | \(371\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [C] Result contains complex when optimal does not.
time = 1.73, size = 116, normalized size = 1.05 \begin {gather*} \frac {{\left (a^{2} {\left (-i \, {\rm Ei}\left (i \, d x\right ) + i \, {\rm Ei}\left (-i \, d x\right )\right )} \cos \left (c\right ) + a^{2} {\left ({\rm Ei}\left (i \, d x\right ) + {\rm Ei}\left (-i \, d x\right )\right )} \sin \left (c\right )\right )} d^{4} - 2 \, {\left (b^{2} d^{3} x^{3} + 2 \, {\left (a b d^{3} - 3 \, b^{2} d\right )} x\right )} \cos \left (d x + c\right ) + 2 \, {\left (3 \, b^{2} d^{2} x^{2} + 2 \, a b d^{2} - 6 \, b^{2}\right )} \sin \left (d x + c\right )}{2 \, d^{4}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.37, size = 114, normalized size = 1.03 \begin {gather*} \frac {2 \, a^{2} d^{4} \cos \left (c\right ) \operatorname {Si}\left (d x\right ) - 2 \, {\left (b^{2} d^{3} x^{3} + 2 \, {\left (a b d^{3} - 3 \, b^{2} d\right )} x\right )} \cos \left (d x + c\right ) + 2 \, {\left (3 \, b^{2} d^{2} x^{2} + 2 \, a b d^{2} - 6 \, b^{2}\right )} \sin \left (d x + c\right ) + {\left (a^{2} d^{4} \operatorname {Ci}\left (d x\right ) + a^{2} d^{4} \operatorname {Ci}\left (-d x\right )\right )} \sin \left (c\right )}{2 \, d^{4}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 4.35, size = 160, normalized size = 1.44 \begin {gather*} a^{2} \sin {\left (c \right )} \operatorname {Ci}{\left (d x \right )} + a^{2} \cos {\left (c \right )} \operatorname {Si}{\left (d x \right )} + 2 a b x \left (\begin {cases} x \sin {\left (c \right )} & \text {for}\: d = 0 \\- \frac {\cos {\left (c + d x \right )}}{d} & \text {otherwise} \end {cases}\right ) - 2 a b \left (\begin {cases} \frac {x^{2} \sin {\left (c \right )}}{2} & \text {for}\: d = 0 \\- \frac {\begin {cases} \frac {\sin {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \cos {\left (c \right )} & \text {otherwise} \end {cases}}{d} & \text {otherwise} \end {cases}\right ) + b^{2} x^{3} \left (\begin {cases} x \sin {\left (c \right )} & \text {for}\: d = 0 \\- \frac {\cos {\left (c + d x \right )}}{d} & \text {otherwise} \end {cases}\right ) - 3 b^{2} \left (\begin {cases} \frac {x^{4} \sin {\left (c \right )}}{4} & \text {for}\: d = 0 \\- \frac {\begin {cases} \frac {x^{2} \sin {\left (c + d x \right )}}{d} + \frac {2 x \cos {\left (c + d x \right )}}{d^{2}} - \frac {2 \sin {\left (c + d x \right )}}{d^{3}} & \text {for}\: d \neq 0 \\\frac {x^{3} \cos {\left (c \right )}}{3} & \text {otherwise} \end {cases}}{d} & \text {otherwise} \end {cases}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [C] Result contains higher order function than in optimal. Order 9 vs. order
4.
time = 3.53, size = 725, normalized size = 6.53 \begin {gather*} \frac {2 \, b^{2} d^{3} x^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (d x\right ) \right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (-d x\right ) \right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - 2 \, a^{2} d^{4} \operatorname {Si}\left (d x\right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, b^{2} d^{3} x^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 2 \, a^{2} d^{4} \Re \left ( \operatorname {Ci}\left (d x\right ) \right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right ) + 2 \, a^{2} d^{4} \Re \left ( \operatorname {Ci}\left (-d x\right ) \right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - 2 \, b^{2} d^{3} x^{3} \tan \left (\frac {1}{2} \, c\right )^{2} + 4 \, a b d^{3} x \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (d x\right ) \right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (-d x\right ) \right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 2 \, a^{2} d^{4} \operatorname {Si}\left (d x\right ) \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (d x\right ) \right ) \tan \left (\frac {1}{2} \, c\right )^{2} + a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (-d x\right ) \right ) \tan \left (\frac {1}{2} \, c\right )^{2} - 2 \, a^{2} d^{4} \operatorname {Si}\left (d x\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + 12 \, b^{2} d^{2} x^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \tan \left (\frac {1}{2} \, c\right )^{2} - 2 \, b^{2} d^{3} x^{3} + 4 \, a b d^{3} x \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 2 \, a^{2} d^{4} \Re \left ( \operatorname {Ci}\left (d x\right ) \right ) \tan \left (\frac {1}{2} \, c\right ) + 2 \, a^{2} d^{4} \Re \left ( \operatorname {Ci}\left (-d x\right ) \right ) \tan \left (\frac {1}{2} \, c\right ) - 4 \, a b d^{3} x \tan \left (\frac {1}{2} \, c\right )^{2} - 12 \, b^{2} d x \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (d x\right ) \right ) - a^{2} d^{4} \Im \left ( \operatorname {Ci}\left (-d x\right ) \right ) + 2 \, a^{2} d^{4} \operatorname {Si}\left (d x\right ) + 12 \, b^{2} d^{2} x^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 8 \, a b d^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \tan \left (\frac {1}{2} \, c\right )^{2} - 4 \, a b d^{3} x - 12 \, b^{2} d x \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 12 \, b^{2} d x \tan \left (\frac {1}{2} \, c\right )^{2} + 8 \, a b d^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 24 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + 12 \, b^{2} d x - 24 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{2 \, {\left (d^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + d^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + d^{4} \tan \left (\frac {1}{2} \, c\right )^{2} + d^{4}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {\sin \left (c+d\,x\right )\,{\left (b\,x^2+a\right )}^2}{x} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________